let fs = require('fs');

var i = 1;
var max = 0;
var min = 1001;
while(i<=100){
    let random = Math.floor(Math.random()*1001);
    fs.writeFileSync("./"+i+".txt",""+random);
    
    var data = fs.readFileSync("./"+i+".txt")
    var num = Number(data.toString());
    if(num>max){
        max=num;
    }
    if(num<min){
        min=num;
    }
    //console.log(max,min)
    i++;
}
console.log("最大值为:"+max+",最小值为:"+min);